package com.wmz.controller;

import com.wmz.domain.SysRole;
import com.wmz.model.Result;
import com.wmz.service.SysRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wmz
 * @date 2024/7/9 22:23
 * @description 系统角色管理控制层
 */
@Api(tags = "系统角色接口管理")
@Component
@RestController
@RequestMapping("sys/role")
public class SysRoleController {
    @Autowired
    private SysRoleService sysRoleService;

    @ApiOperation("查询系统所有角色")
    @GetMapping("list")
    @PreAuthorize("hasAuthority('sys:role:list')")
    public Result<List<SysRole>> loadSysRoleList(){
        List<SysRole> sysRoleList = sysRoleService.querySysRoleList();
        return Result.success(sysRoleList);
    }
}
